/*******************************************************************************
 * @brief: 请填写简介
 * @Author:   aple
 * @Date: 2022-10-28 20:32:14
 * @LastEditors: aple
 * @LastEditTime: 2022-10-28 21:35:45
 * @Verision: 1.0.0.0
 ******************************************************************************/
/*******************************************************************************
 * @brief  uart
 *******************************************************************************/

#include "bsp.h"
#include "com_obj.h"
#include "common.h"

/*******************************************************************************
 * @brief  printf surport
 *******************************************************************************/
#if !defined(__MICROLIB)

#ifdef __ARMCC_VERSION
#if __ARMCC_VERSION >= 6010050
__asm(".global __use_no_semihosting\n\t");
#else
#pragma import(__use_no_semihosting)
struct __FILE
{
	int handle;
};
#endif

FILE __stdout;

#endif

//避免使用半主机模式
void _sys_exit(int x)
{
	(void)x;
}

//__use_no_semihosting was requested, but _ttywrch was
void _ttywrch(int ch)
{
	(void)ch;
}

#endif

#if defined(__GNUC__) && !defined(__clang__)
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif

PUTCHAR_PROTOTYPE
{
#if DBG_EN > 0
	com.obj01.fun->hal_send(ch);
#endif

	return ch;
}

/*******************************************************************************
 * @brief  bsp_uart_init
 * \param[in] none
 * \retval: none
 *******************************************************************************/
void bsp_uart_init(void)
{
	com01_Init(0, 115200, COM_PAR_NONE_1S);
}
